// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Agents;
/// let client = Agents::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
///
/// [google.cloud.dialogflow.v2.Agent]: crate::model::Agent
///
/// # Configuration
///
/// To configure `Agents` use the `with_*` methods in the type returned
/// by [builder()][Agents::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::agents::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::agents::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Agents` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Agents` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "agents")]
#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
#[derive(Clone, Debug)]
pub struct Agents {
    inner: std::sync::Arc<dyn super::stub::dynamic::Agents>,
}

#[cfg(feature = "agents")]
impl Agents {
    /// Returns a builder for [Agents].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Agents;
    /// let client = Agents::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::agents::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::agents::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Agents + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Agents>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Agents> {
        super::transport::Agents::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Agents> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Agents::new)
    }

    /// Retrieves the specified agent.
    pub fn get_agent(&self) -> super::builder::agents::GetAgent {
        super::builder::agents::GetAgent::new(self.inner.clone())
    }

    /// Creates/updates the specified agent.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    pub fn set_agent(&self) -> super::builder::agents::SetAgent {
        super::builder::agents::SetAgent::new(self.inner.clone())
    }

    /// Deletes the specified agent.
    pub fn delete_agent(&self) -> super::builder::agents::DeleteAgent {
        super::builder::agents::DeleteAgent::new(self.inner.clone())
    }

    /// Returns the list of agents.
    ///
    /// Since there is at most one conversational agent per project, this method is
    /// useful primarily for listing all agents across projects the caller has
    /// access to. One can achieve that with a wildcard project collection id "-".
    /// Refer to [List
    /// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
    pub fn search_agents(&self) -> super::builder::agents::SearchAgents {
        super::builder::agents::SearchAgents::new(self.inner.clone())
    }

    /// Trains the specified agent.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn train_agent(&self) -> super::builder::agents::TrainAgent {
        super::builder::agents::TrainAgent::new(self.inner.clone())
    }

    /// Exports the specified agent to a ZIP file.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`:
    ///   [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
    ///
    /// [google.cloud.dialogflow.v2.ExportAgentResponse]: crate::model::ExportAgentResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_agent(&self) -> super::builder::agents::ExportAgent {
        super::builder::agents::ExportAgent::new(self.inner.clone())
    }

    /// Imports the specified agent from a ZIP file.
    ///
    /// Uploads new intents and entity types without deleting the existing ones.
    /// Intents and entity types with the same name are replaced with the new
    /// versions from
    /// [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After
    /// the import, the imported draft agent will be trained automatically (unless
    /// disabled in agent settings). However, once the import is done, training may
    /// not be completed yet. Please call
    /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
    /// operation it returns in order to train explicitly.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// The operation only tracks when importing is complete, not when it is done
    /// training.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
    /// [google.cloud.dialogflow.v2.ImportAgentRequest]: crate::model::ImportAgentRequest
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_agent(&self) -> super::builder::agents::ImportAgent {
        super::builder::agents::ImportAgent::new(self.inner.clone())
    }

    /// Restores the specified agent from a ZIP file.
    ///
    /// Replaces the current agent version with a new one. All the intents and
    /// entity types in the older version are deleted. After the restore, the
    /// restored draft agent will be trained automatically (unless disabled in
    /// agent settings). However, once the restore is done, training may not be
    /// completed yet. Please call
    /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
    /// operation it returns in order to train explicitly.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// The operation only tracks when restoring is complete, not when it is done
    /// training.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn restore_agent(&self) -> super::builder::agents::RestoreAgent {
        super::builder::agents::RestoreAgent::new(self.inner.clone())
    }

    /// Gets agent validation result. Agent validation is performed during
    /// training time and is updated automatically when training is completed.
    pub fn get_validation_result(&self) -> super::builder::agents::GetValidationResult {
        super::builder::agents::GetValidationResult::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::agents::ListLocations {
        super::builder::agents::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::agents::GetLocation {
        super::builder::agents::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::agents::ListOperations {
        super::builder::agents::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::agents::GetOperation {
        super::builder::agents::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::agents::CancelOperation {
        super::builder::agents::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::AnswerRecords;
/// let client = AnswerRecords::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing
/// [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
///
/// [google.cloud.dialogflow.v2.AnswerRecord]: crate::model::AnswerRecord
///
/// # Configuration
///
/// To configure `AnswerRecords` use the `with_*` methods in the type returned
/// by [builder()][AnswerRecords::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::answer_records::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::answer_records::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `AnswerRecords` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `AnswerRecords` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "answer-records")]
#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
#[derive(Clone, Debug)]
pub struct AnswerRecords {
    inner: std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>,
}

#[cfg(feature = "answer-records")]
impl AnswerRecords {
    /// Returns a builder for [AnswerRecords].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
    /// let client = AnswerRecords::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::answer_records::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::answer_records::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::AnswerRecords + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::AnswerRecords> {
        super::transport::AnswerRecords::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::AnswerRecords> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::AnswerRecords::new)
    }

    /// Returns the list of all answer records in the specified project in reverse
    /// chronological order.
    pub fn list_answer_records(&self) -> super::builder::answer_records::ListAnswerRecords {
        super::builder::answer_records::ListAnswerRecords::new(self.inner.clone())
    }

    /// Updates the specified answer record.
    pub fn update_answer_record(&self) -> super::builder::answer_records::UpdateAnswerRecord {
        super::builder::answer_records::UpdateAnswerRecord::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::answer_records::ListLocations {
        super::builder::answer_records::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::answer_records::GetLocation {
        super::builder::answer_records::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::answer_records::ListOperations {
        super::builder::answer_records::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::answer_records::GetOperation {
        super::builder::answer_records::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::answer_records::CancelOperation {
        super::builder::answer_records::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Contexts;
/// let client = Contexts::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Contexts][google.cloud.dialogflow.v2.Context].
///
/// [google.cloud.dialogflow.v2.Context]: crate::model::Context
///
/// # Configuration
///
/// To configure `Contexts` use the `with_*` methods in the type returned
/// by [builder()][Contexts::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::contexts::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::contexts::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Contexts` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Contexts` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "contexts")]
#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
#[derive(Clone, Debug)]
pub struct Contexts {
    inner: std::sync::Arc<dyn super::stub::dynamic::Contexts>,
}

#[cfg(feature = "contexts")]
impl Contexts {
    /// Returns a builder for [Contexts].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Contexts;
    /// let client = Contexts::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::contexts::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::contexts::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Contexts + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Contexts>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Contexts> {
        super::transport::Contexts::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Contexts> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Contexts::new)
    }

    /// Returns the list of all contexts in the specified session.
    pub fn list_contexts(&self) -> super::builder::contexts::ListContexts {
        super::builder::contexts::ListContexts::new(self.inner.clone())
    }

    /// Retrieves the specified context.
    pub fn get_context(&self) -> super::builder::contexts::GetContext {
        super::builder::contexts::GetContext::new(self.inner.clone())
    }

    /// Creates a context.
    ///
    /// If the specified context already exists, overrides the context.
    pub fn create_context(&self) -> super::builder::contexts::CreateContext {
        super::builder::contexts::CreateContext::new(self.inner.clone())
    }

    /// Updates the specified context.
    pub fn update_context(&self) -> super::builder::contexts::UpdateContext {
        super::builder::contexts::UpdateContext::new(self.inner.clone())
    }

    /// Deletes the specified context.
    pub fn delete_context(&self) -> super::builder::contexts::DeleteContext {
        super::builder::contexts::DeleteContext::new(self.inner.clone())
    }

    /// Deletes all active contexts in the specified session.
    pub fn delete_all_contexts(&self) -> super::builder::contexts::DeleteAllContexts {
        super::builder::contexts::DeleteAllContexts::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::contexts::ListLocations {
        super::builder::contexts::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::contexts::GetLocation {
        super::builder::contexts::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::contexts::ListOperations {
        super::builder::contexts::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::contexts::GetOperation {
        super::builder::contexts::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::contexts::CancelOperation {
        super::builder::contexts::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Conversations;
/// let client = Conversations::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing
/// [Conversations][google.cloud.dialogflow.v2.Conversation].
///
/// [google.cloud.dialogflow.v2.Conversation]: crate::model::Conversation
///
/// # Configuration
///
/// To configure `Conversations` use the `with_*` methods in the type returned
/// by [builder()][Conversations::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::conversations::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::conversations::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Conversations` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Conversations` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "conversations")]
#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
#[derive(Clone, Debug)]
pub struct Conversations {
    inner: std::sync::Arc<dyn super::stub::dynamic::Conversations>,
}

#[cfg(feature = "conversations")]
impl Conversations {
    /// Returns a builder for [Conversations].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Conversations;
    /// let client = Conversations::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::conversations::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::conversations::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Conversations + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Conversations>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Conversations> {
        super::transport::Conversations::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Conversations> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Conversations::new)
    }

    /// Creates a new conversation. Conversations are auto-completed after 24
    /// hours.
    ///
    /// Conversation Lifecycle:
    /// There are two stages during a conversation: Automated Agent Stage and
    /// Assist Stage.
    ///
    /// For Automated Agent Stage, there will be a dialogflow agent responding to
    /// user queries.
    ///
    /// For Assist Stage, there's no dialogflow agent responding to user queries.
    /// But we will provide suggestions which are generated from conversation.
    ///
    /// If
    /// [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile]
    /// is configured for a dialogflow agent, conversation will start from
    /// `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And
    /// during `Automated Agent Stage`, once an
    /// [Intent][google.cloud.dialogflow.v2.Intent] with
    /// [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff]
    /// is triggered, conversation will transfer to Assist Stage.
    ///
    /// [google.cloud.dialogflow.v2.Conversation.conversation_profile]: crate::model::Conversation::conversation_profile
    /// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
    /// [google.cloud.dialogflow.v2.Intent.live_agent_handoff]: crate::model::Intent::live_agent_handoff
    pub fn create_conversation(&self) -> super::builder::conversations::CreateConversation {
        super::builder::conversations::CreateConversation::new(self.inner.clone())
    }

    /// Returns the list of all conversations in the specified project.
    pub fn list_conversations(&self) -> super::builder::conversations::ListConversations {
        super::builder::conversations::ListConversations::new(self.inner.clone())
    }

    /// Retrieves the specific conversation.
    pub fn get_conversation(&self) -> super::builder::conversations::GetConversation {
        super::builder::conversations::GetConversation::new(self.inner.clone())
    }

    /// Completes the specified conversation. Finished conversations are purged
    /// from the database after 30 days.
    pub fn complete_conversation(&self) -> super::builder::conversations::CompleteConversation {
        super::builder::conversations::CompleteConversation::new(self.inner.clone())
    }

    /// Data ingestion API.
    /// Ingests context references for an existing conversation.
    pub fn ingest_context_references(
        &self,
    ) -> super::builder::conversations::IngestContextReferences {
        super::builder::conversations::IngestContextReferences::new(self.inner.clone())
    }

    /// Lists messages that belong to a given conversation.
    /// `messages` are ordered by `create_time` in descending order. To fetch
    /// updates without duplication, send request with filter
    /// `create_time_epoch_microseconds >
    /// [first item's create_time of previous request]` and empty page_token.
    pub fn list_messages(&self) -> super::builder::conversations::ListMessages {
        super::builder::conversations::ListMessages::new(self.inner.clone())
    }

    /// Suggests summary for a conversation based on specific historical messages.
    /// The range of the messages to be used for summary can be specified in the
    /// request.
    pub fn suggest_conversation_summary(
        &self,
    ) -> super::builder::conversations::SuggestConversationSummary {
        super::builder::conversations::SuggestConversationSummary::new(self.inner.clone())
    }

    /// Generates and returns a summary for a conversation that does not have a
    /// resource created for it.
    pub fn generate_stateless_summary(
        &self,
    ) -> super::builder::conversations::GenerateStatelessSummary {
        super::builder::conversations::GenerateStatelessSummary::new(self.inner.clone())
    }

    /// Generates and returns a suggestion for a conversation that does not have a
    /// resource created for it.
    pub fn generate_stateless_suggestion(
        &self,
    ) -> super::builder::conversations::GenerateStatelessSuggestion {
        super::builder::conversations::GenerateStatelessSuggestion::new(self.inner.clone())
    }

    /// Get answers for the given query based on knowledge documents.
    pub fn search_knowledge(&self) -> super::builder::conversations::SearchKnowledge {
        super::builder::conversations::SearchKnowledge::new(self.inner.clone())
    }

    /// Generates all the suggestions using generators configured in the
    /// conversation profile. A generator is used only if its trigger event is
    /// matched.
    pub fn generate_suggestions(&self) -> super::builder::conversations::GenerateSuggestions {
        super::builder::conversations::GenerateSuggestions::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::conversations::ListLocations {
        super::builder::conversations::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::conversations::GetLocation {
        super::builder::conversations::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::conversations::ListOperations {
        super::builder::conversations::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::conversations::GetOperation {
        super::builder::conversations::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::conversations::CancelOperation {
        super::builder::conversations::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
/// let client = ConversationDatasets::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Conversation datasets.
///
/// Conversation datasets contain raw conversation files and their
/// customizable metadata that can be used for model training.
///
/// # Configuration
///
/// To configure `ConversationDatasets` use the `with_*` methods in the type returned
/// by [builder()][ConversationDatasets::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::conversation_datasets::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::conversation_datasets::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ConversationDatasets` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ConversationDatasets` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "conversation-datasets")]
#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
#[derive(Clone, Debug)]
pub struct ConversationDatasets {
    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>,
}

#[cfg(feature = "conversation-datasets")]
impl ConversationDatasets {
    /// Returns a builder for [ConversationDatasets].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
    /// let client = ConversationDatasets::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::conversation_datasets::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::conversation_datasets::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ConversationDatasets + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ConversationDatasets> {
        super::transport::ConversationDatasets::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ConversationDatasets> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ConversationDatasets::new)
    }

    /// Creates a new conversation dataset.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]
    /// - `response`:
    ///   [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset]
    ///
    /// [google.cloud.dialogflow.v2.ConversationDataset]: crate::model::ConversationDataset
    /// [google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]: crate::model::CreateConversationDatasetOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_conversation_dataset(
        &self,
    ) -> super::builder::conversation_datasets::CreateConversationDataset {
        super::builder::conversation_datasets::CreateConversationDataset::new(self.inner.clone())
    }

    /// Retrieves the specified conversation dataset.
    pub fn get_conversation_dataset(
        &self,
    ) -> super::builder::conversation_datasets::GetConversationDataset {
        super::builder::conversation_datasets::GetConversationDataset::new(self.inner.clone())
    }

    /// Returns the list of all conversation datasets in the specified
    /// project and location.
    pub fn list_conversation_datasets(
        &self,
    ) -> super::builder::conversation_datasets::ListConversationDatasets {
        super::builder::conversation_datasets::ListConversationDatasets::new(self.inner.clone())
    }

    /// Deletes the specified conversation dataset.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// [google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]: crate::model::DeleteConversationDatasetOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_conversation_dataset(
        &self,
    ) -> super::builder::conversation_datasets::DeleteConversationDataset {
        super::builder::conversation_datasets::DeleteConversationDataset::new(self.inner.clone())
    }

    /// Import data into the specified conversation dataset. Note that it
    /// is not allowed to import data to a conversation dataset that
    /// already has data in it.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]
    /// - `response`:
    ///   [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]
    ///
    /// [google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]: crate::model::ImportConversationDataOperationMetadata
    /// [google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]: crate::model::ImportConversationDataOperationResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_conversation_data(
        &self,
    ) -> super::builder::conversation_datasets::ImportConversationData {
        super::builder::conversation_datasets::ImportConversationData::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::conversation_datasets::ListLocations {
        super::builder::conversation_datasets::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::conversation_datasets::GetLocation {
        super::builder::conversation_datasets::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::conversation_datasets::ListOperations {
        super::builder::conversation_datasets::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::conversation_datasets::GetOperation {
        super::builder::conversation_datasets::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::conversation_datasets::CancelOperation {
        super::builder::conversation_datasets::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::ConversationModels;
/// let client = ConversationModels::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Manages a collection of models for human agent assistant.
///
/// # Configuration
///
/// To configure `ConversationModels` use the `with_*` methods in the type returned
/// by [builder()][ConversationModels::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::conversation_models::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::conversation_models::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ConversationModels` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ConversationModels` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "conversation-models")]
#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
#[derive(Clone, Debug)]
pub struct ConversationModels {
    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationModels>,
}

#[cfg(feature = "conversation-models")]
impl ConversationModels {
    /// Returns a builder for [ConversationModels].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
    /// let client = ConversationModels::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::conversation_models::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::conversation_models::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ConversationModels + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ConversationModels>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ConversationModels> {
        super::transport::ConversationModels::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ConversationModels> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ConversationModels::new)
    }

    /// Creates a model.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]
    /// - `response`:
    ///   [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
    ///
    /// [google.cloud.dialogflow.v2.ConversationModel]: crate::model::ConversationModel
    /// [google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]: crate::model::CreateConversationModelOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_conversation_model(
        &self,
    ) -> super::builder::conversation_models::CreateConversationModel {
        super::builder::conversation_models::CreateConversationModel::new(self.inner.clone())
    }

    /// Gets conversation model.
    pub fn get_conversation_model(
        &self,
    ) -> super::builder::conversation_models::GetConversationModel {
        super::builder::conversation_models::GetConversationModel::new(self.inner.clone())
    }

    /// Lists conversation models.
    pub fn list_conversation_models(
        &self,
    ) -> super::builder::conversation_models::ListConversationModels {
        super::builder::conversation_models::ListConversationModels::new(self.inner.clone())
    }

    /// Deletes a model.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// [google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]: crate::model::DeleteConversationModelOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_conversation_model(
        &self,
    ) -> super::builder::conversation_models::DeleteConversationModel {
        super::builder::conversation_models::DeleteConversationModel::new(self.inner.clone())
    }

    /// Deploys a model. If a model is already deployed, deploying it
    /// has no effect. A model can only serve prediction requests after it gets
    /// deployed. For article suggestion, custom model will not be used unless
    /// it is deployed.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// [google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]: crate::model::DeployConversationModelOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn deploy_conversation_model(
        &self,
    ) -> super::builder::conversation_models::DeployConversationModel {
        super::builder::conversation_models::DeployConversationModel::new(self.inner.clone())
    }

    /// Undeploys a model. If the model is not deployed this method has no effect.
    /// If the model is currently being used:
    ///
    /// - For article suggestion, article suggestion will fallback to the default
    ///   model if model is undeployed.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// [google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]: crate::model::UndeployConversationModelOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn undeploy_conversation_model(
        &self,
    ) -> super::builder::conversation_models::UndeployConversationModel {
        super::builder::conversation_models::UndeployConversationModel::new(self.inner.clone())
    }

    /// Gets an evaluation of conversation model.
    pub fn get_conversation_model_evaluation(
        &self,
    ) -> super::builder::conversation_models::GetConversationModelEvaluation {
        super::builder::conversation_models::GetConversationModelEvaluation::new(self.inner.clone())
    }

    /// Lists evaluations of a conversation model.
    pub fn list_conversation_model_evaluations(
        &self,
    ) -> super::builder::conversation_models::ListConversationModelEvaluations {
        super::builder::conversation_models::ListConversationModelEvaluations::new(
            self.inner.clone(),
        )
    }

    /// Creates evaluation of a conversation model.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_conversation_model_evaluation(
        &self,
    ) -> super::builder::conversation_models::CreateConversationModelEvaluation {
        super::builder::conversation_models::CreateConversationModelEvaluation::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::conversation_models::ListLocations {
        super::builder::conversation_models::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::conversation_models::GetLocation {
        super::builder::conversation_models::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::conversation_models::ListOperations {
        super::builder::conversation_models::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::conversation_models::GetOperation {
        super::builder::conversation_models::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::conversation_models::CancelOperation {
        super::builder::conversation_models::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
/// let client = ConversationProfiles::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing
/// [ConversationProfiles][google.cloud.dialogflow.v2.ConversationProfile].
///
/// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
///
/// # Configuration
///
/// To configure `ConversationProfiles` use the `with_*` methods in the type returned
/// by [builder()][ConversationProfiles::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::conversation_profiles::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::conversation_profiles::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ConversationProfiles` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ConversationProfiles` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "conversation-profiles")]
#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
#[derive(Clone, Debug)]
pub struct ConversationProfiles {
    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>,
}

#[cfg(feature = "conversation-profiles")]
impl ConversationProfiles {
    /// Returns a builder for [ConversationProfiles].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
    /// let client = ConversationProfiles::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::conversation_profiles::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::conversation_profiles::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ConversationProfiles + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ConversationProfiles> {
        super::transport::ConversationProfiles::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ConversationProfiles> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ConversationProfiles::new)
    }

    /// Returns the list of all conversation profiles in the specified project.
    pub fn list_conversation_profiles(
        &self,
    ) -> super::builder::conversation_profiles::ListConversationProfiles {
        super::builder::conversation_profiles::ListConversationProfiles::new(self.inner.clone())
    }

    /// Retrieves the specified conversation profile.
    pub fn get_conversation_profile(
        &self,
    ) -> super::builder::conversation_profiles::GetConversationProfile {
        super::builder::conversation_profiles::GetConversationProfile::new(self.inner.clone())
    }

    /// Creates a conversation profile in the specified project.
    ///
    /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
    /// and
    /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
    /// aren't populated in the response. You can retrieve them via
    /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
    /// API.
    ///
    /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
    /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
    /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
    pub fn create_conversation_profile(
        &self,
    ) -> super::builder::conversation_profiles::CreateConversationProfile {
        super::builder::conversation_profiles::CreateConversationProfile::new(self.inner.clone())
    }

    /// Updates the specified conversation profile.
    ///
    /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
    /// and
    /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
    /// aren't populated in the response. You can retrieve them via
    /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
    /// API.
    ///
    /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
    /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
    /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
    pub fn update_conversation_profile(
        &self,
    ) -> super::builder::conversation_profiles::UpdateConversationProfile {
        super::builder::conversation_profiles::UpdateConversationProfile::new(self.inner.clone())
    }

    /// Deletes the specified conversation profile.
    pub fn delete_conversation_profile(
        &self,
    ) -> super::builder::conversation_profiles::DeleteConversationProfile {
        super::builder::conversation_profiles::DeleteConversationProfile::new(self.inner.clone())
    }

    /// Adds or updates a suggestion feature in a conversation profile.
    /// If the conversation profile contains the type of suggestion feature for
    /// the participant role, it will update it. Otherwise it will insert the
    /// suggestion feature.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]
    /// - `response`:
    ///   [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
    ///
    /// If a long running operation to add or update suggestion feature
    /// config for the same conversation profile, participant role and suggestion
    /// feature type exists, please cancel the existing long running operation
    /// before sending such request, otherwise the request will be rejected.
    ///
    /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
    /// [google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]: crate::model::SetSuggestionFeatureConfigOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn set_suggestion_feature_config(
        &self,
    ) -> super::builder::conversation_profiles::SetSuggestionFeatureConfig {
        super::builder::conversation_profiles::SetSuggestionFeatureConfig::new(self.inner.clone())
    }

    /// Clears a suggestion feature from a conversation profile for the given
    /// participant role.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]
    /// - `response`:
    ///   [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
    ///
    /// [google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]: crate::model::ClearSuggestionFeatureConfigOperationMetadata
    /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn clear_suggestion_feature_config(
        &self,
    ) -> super::builder::conversation_profiles::ClearSuggestionFeatureConfig {
        super::builder::conversation_profiles::ClearSuggestionFeatureConfig::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::conversation_profiles::ListLocations {
        super::builder::conversation_profiles::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::conversation_profiles::GetLocation {
        super::builder::conversation_profiles::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::conversation_profiles::ListOperations {
        super::builder::conversation_profiles::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::conversation_profiles::GetOperation {
        super::builder::conversation_profiles::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::conversation_profiles::CancelOperation {
        super::builder::conversation_profiles::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Documents;
/// let client = Documents::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing knowledge
/// [Documents][google.cloud.dialogflow.v2.Document].
///
/// [google.cloud.dialogflow.v2.Document]: crate::model::Document
///
/// # Configuration
///
/// To configure `Documents` use the `with_*` methods in the type returned
/// by [builder()][Documents::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::documents::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::documents::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Documents` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Documents` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "documents")]
#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
#[derive(Clone, Debug)]
pub struct Documents {
    inner: std::sync::Arc<dyn super::stub::dynamic::Documents>,
}

#[cfg(feature = "documents")]
impl Documents {
    /// Returns a builder for [Documents].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Documents;
    /// let client = Documents::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::documents::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::documents::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Documents + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Documents>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Documents> {
        super::transport::Documents::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Documents> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Documents::new)
    }

    /// Returns the list of all documents of the knowledge base.
    pub fn list_documents(&self) -> super::builder::documents::ListDocuments {
        super::builder::documents::ListDocuments::new(self.inner.clone())
    }

    /// Retrieves the specified document.
    pub fn get_document(&self) -> super::builder::documents::GetDocument {
        super::builder::documents::GetDocument::new(self.inner.clone())
    }

    /// Creates a new document.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
    ///
    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_document(&self) -> super::builder::documents::CreateDocument {
        super::builder::documents::CreateDocument::new(self.inner.clone())
    }

    /// Creates documents by importing data from external sources.
    /// Dialogflow supports up to 350 documents in each request. If you try to
    /// import more, Dialogflow will return an error.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
    /// - `response`:
    ///   [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
    ///
    /// [google.cloud.dialogflow.v2.ImportDocumentsResponse]: crate::model::ImportDocumentsResponse
    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_documents(&self) -> super::builder::documents::ImportDocuments {
        super::builder::documents::ImportDocuments::new(self.inner.clone())
    }

    /// Deletes the specified document.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_document(&self) -> super::builder::documents::DeleteDocument {
        super::builder::documents::DeleteDocument::new(self.inner.clone())
    }

    /// Updates the specified document.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
    ///
    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_document(&self) -> super::builder::documents::UpdateDocument {
        super::builder::documents::UpdateDocument::new(self.inner.clone())
    }

    /// Reloads the specified document from its specified source, content_uri or
    /// content. The previously loaded content of the document will be deleted.
    /// Note: Even when the content of the document has not changed, there still
    /// may be side effects because of internal implementation changes.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
    ///
    /// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
    /// only use `projects.knowledgeBases.documents`.
    ///
    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn reload_document(&self) -> super::builder::documents::ReloadDocument {
        super::builder::documents::ReloadDocument::new(self.inner.clone())
    }

    /// Exports a smart messaging candidate document into the specified
    /// destination.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
    ///
    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_document(&self) -> super::builder::documents::ExportDocument {
        super::builder::documents::ExportDocument::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::documents::ListLocations {
        super::builder::documents::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::documents::GetLocation {
        super::builder::documents::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::documents::ListOperations {
        super::builder::documents::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::documents::GetOperation {
        super::builder::documents::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::documents::CancelOperation {
        super::builder::documents::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
/// let client = EncryptionSpecService::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Manages encryption spec settings for Dialogflow and Agent Assist.
///
/// # Configuration
///
/// To configure `EncryptionSpecService` use the `with_*` methods in the type returned
/// by [builder()][EncryptionSpecService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::encryption_spec_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::encryption_spec_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `EncryptionSpecService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `EncryptionSpecService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "encryption-spec-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
#[derive(Clone, Debug)]
pub struct EncryptionSpecService {
    inner: std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>,
}

#[cfg(feature = "encryption-spec-service")]
impl EncryptionSpecService {
    /// Returns a builder for [EncryptionSpecService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
    /// let client = EncryptionSpecService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::encryption_spec_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::encryption_spec_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::EncryptionSpecService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EncryptionSpecService> {
        super::transport::EncryptionSpecService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EncryptionSpecService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::EncryptionSpecService::new)
    }

    /// Gets location-level encryption key specification.
    pub fn get_encryption_spec(
        &self,
    ) -> super::builder::encryption_spec_service::GetEncryptionSpec {
        super::builder::encryption_spec_service::GetEncryptionSpec::new(self.inner.clone())
    }

    /// Initializes a location-level encryption key specification.  An error will
    /// be thrown if the location has resources already created before the
    /// initialization. Once the encryption specification is initialized at a
    /// location, it is immutable and all newly created resources under the
    /// location will be encrypted with the existing specification.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn initialize_encryption_spec(
        &self,
    ) -> super::builder::encryption_spec_service::InitializeEncryptionSpec {
        super::builder::encryption_spec_service::InitializeEncryptionSpec::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::encryption_spec_service::ListLocations {
        super::builder::encryption_spec_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::encryption_spec_service::GetLocation {
        super::builder::encryption_spec_service::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::encryption_spec_service::ListOperations {
        super::builder::encryption_spec_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::encryption_spec_service::GetOperation {
        super::builder::encryption_spec_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::encryption_spec_service::CancelOperation {
        super::builder::encryption_spec_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::EntityTypes;
/// let client = EntityTypes::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType].
///
/// [google.cloud.dialogflow.v2.EntityType]: crate::model::EntityType
///
/// # Configuration
///
/// To configure `EntityTypes` use the `with_*` methods in the type returned
/// by [builder()][EntityTypes::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::entity_types::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::entity_types::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `EntityTypes` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `EntityTypes` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "entity-types")]
#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
#[derive(Clone, Debug)]
pub struct EntityTypes {
    inner: std::sync::Arc<dyn super::stub::dynamic::EntityTypes>,
}

#[cfg(feature = "entity-types")]
impl EntityTypes {
    /// Returns a builder for [EntityTypes].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
    /// let client = EntityTypes::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::entity_types::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::entity_types::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::EntityTypes + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EntityTypes>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EntityTypes> {
        super::transport::EntityTypes::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EntityTypes> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::EntityTypes::new)
    }

    /// Returns the list of all entity types in the specified agent.
    pub fn list_entity_types(&self) -> super::builder::entity_types::ListEntityTypes {
        super::builder::entity_types::ListEntityTypes::new(self.inner.clone())
    }

    /// Retrieves the specified entity type.
    pub fn get_entity_type(&self) -> super::builder::entity_types::GetEntityType {
        super::builder::entity_types::GetEntityType::new(self.inner.clone())
    }

    /// Creates an entity type in the specified agent.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    pub fn create_entity_type(&self) -> super::builder::entity_types::CreateEntityType {
        super::builder::entity_types::CreateEntityType::new(self.inner.clone())
    }

    /// Updates the specified entity type.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    pub fn update_entity_type(&self) -> super::builder::entity_types::UpdateEntityType {
        super::builder::entity_types::UpdateEntityType::new(self.inner.clone())
    }

    /// Deletes the specified entity type.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    pub fn delete_entity_type(&self) -> super::builder::entity_types::DeleteEntityType {
        super::builder::entity_types::DeleteEntityType::new(self.inner.clone())
    }

    /// Updates/Creates multiple entity types in the specified agent.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`:
    ///   [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// [google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]: crate::model::BatchUpdateEntityTypesResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_update_entity_types(
        &self,
    ) -> super::builder::entity_types::BatchUpdateEntityTypes {
        super::builder::entity_types::BatchUpdateEntityTypes::new(self.inner.clone())
    }

    /// Deletes entity types in the specified agent.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_delete_entity_types(
        &self,
    ) -> super::builder::entity_types::BatchDeleteEntityTypes {
        super::builder::entity_types::BatchDeleteEntityTypes::new(self.inner.clone())
    }

    /// Creates multiple new entities in the specified entity type.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_create_entities(&self) -> super::builder::entity_types::BatchCreateEntities {
        super::builder::entity_types::BatchCreateEntities::new(self.inner.clone())
    }

    /// Updates or creates multiple entities in the specified entity type. This
    /// method does not affect entities in the entity type that aren't explicitly
    /// specified in the request.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_update_entities(&self) -> super::builder::entity_types::BatchUpdateEntities {
        super::builder::entity_types::BatchUpdateEntities::new(self.inner.clone())
    }

    /// Deletes entities in the specified entity type.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_delete_entities(&self) -> super::builder::entity_types::BatchDeleteEntities {
        super::builder::entity_types::BatchDeleteEntities::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::entity_types::ListLocations {
        super::builder::entity_types::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::entity_types::GetLocation {
        super::builder::entity_types::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::entity_types::ListOperations {
        super::builder::entity_types::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::entity_types::GetOperation {
        super::builder::entity_types::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::entity_types::CancelOperation {
        super::builder::entity_types::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Environments;
/// let client = Environments::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
///
/// [google.cloud.dialogflow.v2.Environment]: crate::model::Environment
///
/// # Configuration
///
/// To configure `Environments` use the `with_*` methods in the type returned
/// by [builder()][Environments::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::environments::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::environments::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Environments` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Environments` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "environments")]
#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
#[derive(Clone, Debug)]
pub struct Environments {
    inner: std::sync::Arc<dyn super::stub::dynamic::Environments>,
}

#[cfg(feature = "environments")]
impl Environments {
    /// Returns a builder for [Environments].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Environments;
    /// let client = Environments::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::environments::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::environments::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Environments + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Environments>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Environments> {
        super::transport::Environments::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Environments> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Environments::new)
    }

    /// Returns the list of all non-default environments of the specified agent.
    pub fn list_environments(&self) -> super::builder::environments::ListEnvironments {
        super::builder::environments::ListEnvironments::new(self.inner.clone())
    }

    /// Retrieves the specified agent environment.
    pub fn get_environment(&self) -> super::builder::environments::GetEnvironment {
        super::builder::environments::GetEnvironment::new(self.inner.clone())
    }

    /// Creates an agent environment.
    pub fn create_environment(&self) -> super::builder::environments::CreateEnvironment {
        super::builder::environments::CreateEnvironment::new(self.inner.clone())
    }

    /// Updates the specified agent environment.
    ///
    /// This method allows you to deploy new agent versions into the environment.
    /// When an environment is pointed to a new agent version by setting
    /// `environment.agent_version`, the environment is temporarily set to the
    /// `LOADING` state. During that time, the environment continues serving the
    /// previous version of the agent. After the new agent version is done loading,
    /// the environment is set back to the `RUNNING` state.
    /// You can use "-" as Environment ID in environment name to update an agent
    /// version in the default environment. WARNING: this will negate all recent
    /// changes to the draft agent and can't be undone. You may want to save the
    /// draft agent to a version before calling this method.
    pub fn update_environment(&self) -> super::builder::environments::UpdateEnvironment {
        super::builder::environments::UpdateEnvironment::new(self.inner.clone())
    }

    /// Deletes the specified agent environment.
    pub fn delete_environment(&self) -> super::builder::environments::DeleteEnvironment {
        super::builder::environments::DeleteEnvironment::new(self.inner.clone())
    }

    /// Gets the history of the specified environment.
    pub fn get_environment_history(&self) -> super::builder::environments::GetEnvironmentHistory {
        super::builder::environments::GetEnvironmentHistory::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::environments::ListLocations {
        super::builder::environments::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::environments::GetLocation {
        super::builder::environments::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::environments::ListOperations {
        super::builder::environments::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::environments::GetOperation {
        super::builder::environments::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::environments::CancelOperation {
        super::builder::environments::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Fulfillments;
/// let client = Fulfillments::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment].
///
/// [google.cloud.dialogflow.v2.Fulfillment]: crate::model::Fulfillment
///
/// # Configuration
///
/// To configure `Fulfillments` use the `with_*` methods in the type returned
/// by [builder()][Fulfillments::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::fulfillments::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::fulfillments::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Fulfillments` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Fulfillments` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "fulfillments")]
#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
#[derive(Clone, Debug)]
pub struct Fulfillments {
    inner: std::sync::Arc<dyn super::stub::dynamic::Fulfillments>,
}

#[cfg(feature = "fulfillments")]
impl Fulfillments {
    /// Returns a builder for [Fulfillments].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
    /// let client = Fulfillments::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::fulfillments::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::fulfillments::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Fulfillments + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Fulfillments>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Fulfillments> {
        super::transport::Fulfillments::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Fulfillments> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Fulfillments::new)
    }

    /// Retrieves the fulfillment.
    pub fn get_fulfillment(&self) -> super::builder::fulfillments::GetFulfillment {
        super::builder::fulfillments::GetFulfillment::new(self.inner.clone())
    }

    /// Updates the fulfillment.
    pub fn update_fulfillment(&self) -> super::builder::fulfillments::UpdateFulfillment {
        super::builder::fulfillments::UpdateFulfillment::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::fulfillments::ListLocations {
        super::builder::fulfillments::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::fulfillments::GetLocation {
        super::builder::fulfillments::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::fulfillments::ListOperations {
        super::builder::fulfillments::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::fulfillments::GetOperation {
        super::builder::fulfillments::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::fulfillments::CancelOperation {
        super::builder::fulfillments::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Generators;
/// let client = Generators::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Generator Service for LLM powered Agent Assist. This service manages the
/// configurations of user owned Generators, such as description, context and
/// instruction, input/output format, etc. The generator resources will be used
/// inside a conversation and will be triggered by TriggerEvent to query LLM for
/// answers.
///
/// # Configuration
///
/// To configure `Generators` use the `with_*` methods in the type returned
/// by [builder()][Generators::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::generators::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::generators::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Generators` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Generators` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "generators")]
#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
#[derive(Clone, Debug)]
pub struct Generators {
    inner: std::sync::Arc<dyn super::stub::dynamic::Generators>,
}

#[cfg(feature = "generators")]
impl Generators {
    /// Returns a builder for [Generators].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Generators;
    /// let client = Generators::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::generators::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::generators::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Generators + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Generators>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Generators> {
        super::transport::Generators::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Generators> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Generators::new)
    }

    /// Creates a generator.
    pub fn create_generator(&self) -> super::builder::generators::CreateGenerator {
        super::builder::generators::CreateGenerator::new(self.inner.clone())
    }

    /// Retrieves a generator.
    pub fn get_generator(&self) -> super::builder::generators::GetGenerator {
        super::builder::generators::GetGenerator::new(self.inner.clone())
    }

    /// Lists generators.
    pub fn list_generators(&self) -> super::builder::generators::ListGenerators {
        super::builder::generators::ListGenerators::new(self.inner.clone())
    }

    /// Deletes a generator.
    pub fn delete_generator(&self) -> super::builder::generators::DeleteGenerator {
        super::builder::generators::DeleteGenerator::new(self.inner.clone())
    }

    /// Updates a generator.
    pub fn update_generator(&self) -> super::builder::generators::UpdateGenerator {
        super::builder::generators::UpdateGenerator::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::generators::ListLocations {
        super::builder::generators::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::generators::GetLocation {
        super::builder::generators::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::generators::ListOperations {
        super::builder::generators::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::generators::GetOperation {
        super::builder::generators::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::generators::CancelOperation {
        super::builder::generators::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Intents;
/// let client = Intents::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Intents][google.cloud.dialogflow.v2.Intent].
///
/// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
///
/// # Configuration
///
/// To configure `Intents` use the `with_*` methods in the type returned
/// by [builder()][Intents::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::intents::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::intents::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Intents` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Intents` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "intents")]
#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
#[derive(Clone, Debug)]
pub struct Intents {
    inner: std::sync::Arc<dyn super::stub::dynamic::Intents>,
}

#[cfg(feature = "intents")]
impl Intents {
    /// Returns a builder for [Intents].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Intents;
    /// let client = Intents::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::intents::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::intents::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Intents + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Intents>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Intents> {
        super::transport::Intents::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Intents> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Intents::new)
    }

    /// Returns the list of all intents in the specified agent.
    pub fn list_intents(&self) -> super::builder::intents::ListIntents {
        super::builder::intents::ListIntents::new(self.inner.clone())
    }

    /// Retrieves the specified intent.
    pub fn get_intent(&self) -> super::builder::intents::GetIntent {
        super::builder::intents::GetIntent::new(self.inner.clone())
    }

    /// Creates an intent in the specified agent.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    pub fn create_intent(&self) -> super::builder::intents::CreateIntent {
        super::builder::intents::CreateIntent::new(self.inner.clone())
    }

    /// Updates the specified intent.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    pub fn update_intent(&self) -> super::builder::intents::UpdateIntent {
        super::builder::intents::UpdateIntent::new(self.inner.clone())
    }

    /// Deletes the specified intent and its direct or indirect followup intents.
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    pub fn delete_intent(&self) -> super::builder::intents::DeleteIntent {
        super::builder::intents::DeleteIntent::new(self.inner.clone())
    }

    /// Updates/Creates multiple intents in the specified agent.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`:
    ///   [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// [google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]: crate::model::BatchUpdateIntentsResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_update_intents(&self) -> super::builder::intents::BatchUpdateIntents {
        super::builder::intents::BatchUpdateIntents::new(self.inner.clone())
    }

    /// Deletes intents in the specified agent.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// Note: You should always train an agent prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_delete_intents(&self) -> super::builder::intents::BatchDeleteIntents {
        super::builder::intents::BatchDeleteIntents::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::intents::ListLocations {
        super::builder::intents::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::intents::GetLocation {
        super::builder::intents::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::intents::ListOperations {
        super::builder::intents::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::intents::GetOperation {
        super::builder::intents::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::intents::CancelOperation {
        super::builder::intents::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
/// let client = KnowledgeBases::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing
/// [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase].
///
/// [google.cloud.dialogflow.v2.KnowledgeBase]: crate::model::KnowledgeBase
///
/// # Configuration
///
/// To configure `KnowledgeBases` use the `with_*` methods in the type returned
/// by [builder()][KnowledgeBases::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::knowledge_bases::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::knowledge_bases::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `KnowledgeBases` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `KnowledgeBases` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "knowledge-bases")]
#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
#[derive(Clone, Debug)]
pub struct KnowledgeBases {
    inner: std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>,
}

#[cfg(feature = "knowledge-bases")]
impl KnowledgeBases {
    /// Returns a builder for [KnowledgeBases].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
    /// let client = KnowledgeBases::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::knowledge_bases::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::knowledge_bases::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::KnowledgeBases + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::KnowledgeBases> {
        super::transport::KnowledgeBases::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::KnowledgeBases> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::KnowledgeBases::new)
    }

    /// Returns the list of all knowledge bases of the specified agent.
    pub fn list_knowledge_bases(&self) -> super::builder::knowledge_bases::ListKnowledgeBases {
        super::builder::knowledge_bases::ListKnowledgeBases::new(self.inner.clone())
    }

    /// Retrieves the specified knowledge base.
    pub fn get_knowledge_base(&self) -> super::builder::knowledge_bases::GetKnowledgeBase {
        super::builder::knowledge_bases::GetKnowledgeBase::new(self.inner.clone())
    }

    /// Creates a knowledge base.
    pub fn create_knowledge_base(&self) -> super::builder::knowledge_bases::CreateKnowledgeBase {
        super::builder::knowledge_bases::CreateKnowledgeBase::new(self.inner.clone())
    }

    /// Deletes the specified knowledge base.
    pub fn delete_knowledge_base(&self) -> super::builder::knowledge_bases::DeleteKnowledgeBase {
        super::builder::knowledge_bases::DeleteKnowledgeBase::new(self.inner.clone())
    }

    /// Updates the specified knowledge base.
    pub fn update_knowledge_base(&self) -> super::builder::knowledge_bases::UpdateKnowledgeBase {
        super::builder::knowledge_bases::UpdateKnowledgeBase::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::knowledge_bases::ListLocations {
        super::builder::knowledge_bases::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::knowledge_bases::GetLocation {
        super::builder::knowledge_bases::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::knowledge_bases::ListOperations {
        super::builder::knowledge_bases::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::knowledge_bases::GetOperation {
        super::builder::knowledge_bases::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::knowledge_bases::CancelOperation {
        super::builder::knowledge_bases::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Participants;
/// let client = Participants::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Participants][google.cloud.dialogflow.v2.Participant].
///
/// [google.cloud.dialogflow.v2.Participant]: crate::model::Participant
///
/// # Configuration
///
/// To configure `Participants` use the `with_*` methods in the type returned
/// by [builder()][Participants::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::participants::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::participants::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Participants` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Participants` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "participants")]
#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
#[derive(Clone, Debug)]
pub struct Participants {
    inner: std::sync::Arc<dyn super::stub::dynamic::Participants>,
}

#[cfg(feature = "participants")]
impl Participants {
    /// Returns a builder for [Participants].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Participants;
    /// let client = Participants::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::participants::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::participants::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Participants + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Participants>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Participants> {
        super::transport::Participants::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Participants> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Participants::new)
    }

    /// Creates a new participant in a conversation.
    pub fn create_participant(&self) -> super::builder::participants::CreateParticipant {
        super::builder::participants::CreateParticipant::new(self.inner.clone())
    }

    /// Retrieves a conversation participant.
    pub fn get_participant(&self) -> super::builder::participants::GetParticipant {
        super::builder::participants::GetParticipant::new(self.inner.clone())
    }

    /// Returns the list of all participants in the specified conversation.
    pub fn list_participants(&self) -> super::builder::participants::ListParticipants {
        super::builder::participants::ListParticipants::new(self.inner.clone())
    }

    /// Updates the specified participant.
    pub fn update_participant(&self) -> super::builder::participants::UpdateParticipant {
        super::builder::participants::UpdateParticipant::new(self.inner.clone())
    }

    /// Adds a text (chat, for example), or audio (phone recording, for example)
    /// message from a participant into the conversation.
    ///
    /// Note: Always use agent versions for production traffic
    /// sent to virtual agents. See [Versions and
    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
    pub fn analyze_content(&self) -> super::builder::participants::AnalyzeContent {
        super::builder::participants::AnalyzeContent::new(self.inner.clone())
    }

    /// Gets suggested articles for a participant based on specific historical
    /// messages.
    pub fn suggest_articles(&self) -> super::builder::participants::SuggestArticles {
        super::builder::participants::SuggestArticles::new(self.inner.clone())
    }

    /// Gets suggested faq answers for a participant based on specific historical
    /// messages.
    pub fn suggest_faq_answers(&self) -> super::builder::participants::SuggestFaqAnswers {
        super::builder::participants::SuggestFaqAnswers::new(self.inner.clone())
    }

    /// Gets smart replies for a participant based on specific historical
    /// messages.
    pub fn suggest_smart_replies(&self) -> super::builder::participants::SuggestSmartReplies {
        super::builder::participants::SuggestSmartReplies::new(self.inner.clone())
    }

    /// Gets knowledge assist suggestions based on historical messages.
    pub fn suggest_knowledge_assist(&self) -> super::builder::participants::SuggestKnowledgeAssist {
        super::builder::participants::SuggestKnowledgeAssist::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::participants::ListLocations {
        super::builder::participants::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::participants::GetLocation {
        super::builder::participants::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::participants::ListOperations {
        super::builder::participants::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::participants::GetOperation {
        super::builder::participants::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::participants::CancelOperation {
        super::builder::participants::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Sessions;
/// let client = Sessions::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service used for session interactions.
///
/// For more information, see the [API interactions
/// guide](https://cloud.google.com/dialogflow/docs/api-overview).
///
/// # Configuration
///
/// To configure `Sessions` use the `with_*` methods in the type returned
/// by [builder()][Sessions::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::sessions::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::sessions::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Sessions` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Sessions` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "sessions")]
#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
#[derive(Clone, Debug)]
pub struct Sessions {
    inner: std::sync::Arc<dyn super::stub::dynamic::Sessions>,
}

#[cfg(feature = "sessions")]
impl Sessions {
    /// Returns a builder for [Sessions].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Sessions;
    /// let client = Sessions::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::sessions::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::sessions::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Sessions + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Sessions>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Sessions> {
        super::transport::Sessions::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Sessions> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Sessions::new)
    }

    /// Processes a natural language query and returns structured, actionable data
    /// as a result. This method is not idempotent, because it may cause contexts
    /// and session entity types to be updated, which in turn might affect
    /// results of future queries.
    ///
    /// If you might use
    /// [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
    /// or other CCAI products now or in the future, consider using
    /// [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
    /// instead of `DetectIntent`. `AnalyzeContent` has additional
    /// functionality for Agent Assist and other CCAI products.
    ///
    /// Note: Always use agent versions for production traffic.
    /// See [Versions and
    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
    ///
    /// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
    pub fn detect_intent(&self) -> super::builder::sessions::DetectIntent {
        super::builder::sessions::DetectIntent::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::sessions::ListLocations {
        super::builder::sessions::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::sessions::GetLocation {
        super::builder::sessions::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::sessions::ListOperations {
        super::builder::sessions::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::sessions::GetOperation {
        super::builder::sessions::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::sessions::CancelOperation {
        super::builder::sessions::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
/// let client = SessionEntityTypes::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing
/// [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType].
///
/// [google.cloud.dialogflow.v2.SessionEntityType]: crate::model::SessionEntityType
///
/// # Configuration
///
/// To configure `SessionEntityTypes` use the `with_*` methods in the type returned
/// by [builder()][SessionEntityTypes::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::session_entity_types::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::session_entity_types::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `SessionEntityTypes` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `SessionEntityTypes` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "session-entity-types")]
#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
#[derive(Clone, Debug)]
pub struct SessionEntityTypes {
    inner: std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>,
}

#[cfg(feature = "session-entity-types")]
impl SessionEntityTypes {
    /// Returns a builder for [SessionEntityTypes].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
    /// let client = SessionEntityTypes::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::session_entity_types::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::session_entity_types::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::SessionEntityTypes + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::SessionEntityTypes> {
        super::transport::SessionEntityTypes::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::SessionEntityTypes> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::SessionEntityTypes::new)
    }

    /// Returns the list of all session entity types in the specified session.
    ///
    /// This method doesn't work with Google Assistant integration.
    /// Contact Dialogflow support if you need to use session entities
    /// with Google Assistant integration.
    pub fn list_session_entity_types(
        &self,
    ) -> super::builder::session_entity_types::ListSessionEntityTypes {
        super::builder::session_entity_types::ListSessionEntityTypes::new(self.inner.clone())
    }

    /// Retrieves the specified session entity type.
    ///
    /// This method doesn't work with Google Assistant integration.
    /// Contact Dialogflow support if you need to use session entities
    /// with Google Assistant integration.
    pub fn get_session_entity_type(
        &self,
    ) -> super::builder::session_entity_types::GetSessionEntityType {
        super::builder::session_entity_types::GetSessionEntityType::new(self.inner.clone())
    }

    /// Creates a session entity type.
    ///
    /// If the specified session entity type already exists, overrides the session
    /// entity type.
    ///
    /// This method doesn't work with Google Assistant integration.
    /// Contact Dialogflow support if you need to use session entities
    /// with Google Assistant integration.
    pub fn create_session_entity_type(
        &self,
    ) -> super::builder::session_entity_types::CreateSessionEntityType {
        super::builder::session_entity_types::CreateSessionEntityType::new(self.inner.clone())
    }

    /// Updates the specified session entity type.
    ///
    /// This method doesn't work with Google Assistant integration.
    /// Contact Dialogflow support if you need to use session entities
    /// with Google Assistant integration.
    pub fn update_session_entity_type(
        &self,
    ) -> super::builder::session_entity_types::UpdateSessionEntityType {
        super::builder::session_entity_types::UpdateSessionEntityType::new(self.inner.clone())
    }

    /// Deletes the specified session entity type.
    ///
    /// This method doesn't work with Google Assistant integration.
    /// Contact Dialogflow support if you need to use session entities
    /// with Google Assistant integration.
    pub fn delete_session_entity_type(
        &self,
    ) -> super::builder::session_entity_types::DeleteSessionEntityType {
        super::builder::session_entity_types::DeleteSessionEntityType::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::session_entity_types::ListLocations {
        super::builder::session_entity_types::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::session_entity_types::GetLocation {
        super::builder::session_entity_types::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::session_entity_types::ListOperations {
        super::builder::session_entity_types::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::session_entity_types::GetOperation {
        super::builder::session_entity_types::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::session_entity_types::CancelOperation {
        super::builder::session_entity_types::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_v2::client::Versions;
/// let client = Versions::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Versions][google.cloud.dialogflow.v2.Version].
///
/// [google.cloud.dialogflow.v2.Version]: crate::model::Version
///
/// # Configuration
///
/// To configure `Versions` use the `with_*` methods in the type returned
/// by [builder()][Versions::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::versions::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::versions::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Versions` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Versions` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "versions")]
#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
#[derive(Clone, Debug)]
pub struct Versions {
    inner: std::sync::Arc<dyn super::stub::dynamic::Versions>,
}

#[cfg(feature = "versions")]
impl Versions {
    /// Returns a builder for [Versions].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_v2::client::Versions;
    /// let client = Versions::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::versions::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::versions::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Versions + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Versions>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Versions> {
        super::transport::Versions::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Versions> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Versions::new)
    }

    /// Returns the list of all versions of the specified agent.
    pub fn list_versions(&self) -> super::builder::versions::ListVersions {
        super::builder::versions::ListVersions::new(self.inner.clone())
    }

    /// Retrieves the specified agent version.
    pub fn get_version(&self) -> super::builder::versions::GetVersion {
        super::builder::versions::GetVersion::new(self.inner.clone())
    }

    /// Creates an agent version.
    ///
    /// The new version points to the agent instance in the "default" environment.
    pub fn create_version(&self) -> super::builder::versions::CreateVersion {
        super::builder::versions::CreateVersion::new(self.inner.clone())
    }

    /// Updates the specified agent version.
    ///
    /// Note that this method does not allow you to update the state of the agent
    /// the given version points to. It allows you to update only mutable
    /// properties of the version resource.
    pub fn update_version(&self) -> super::builder::versions::UpdateVersion {
        super::builder::versions::UpdateVersion::new(self.inner.clone())
    }

    /// Delete the specified agent version.
    pub fn delete_version(&self) -> super::builder::versions::DeleteVersion {
        super::builder::versions::DeleteVersion::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::versions::ListLocations {
        super::builder::versions::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::versions::GetLocation {
        super::builder::versions::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::versions::ListOperations {
        super::builder::versions::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::versions::GetOperation {
        super::builder::versions::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::versions::CancelOperation {
        super::builder::versions::CancelOperation::new(self.inner.clone())
    }
}
